package com.bw.zhuangao5___day002.Adpter.FragmentAdpter;

import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;

import java.util.List;

/**
 * create by ertu
 * create on 2021/9/7
 * description
 */
public class FragmentAdpterTwo extends FragmentStatePagerAdapter {


    List<Fragment> fragments;
    List<String> stringList;

    public FragmentAdpterTwo(@NonNull FragmentManager fm, int behavior, List<Fragment> fragments, List<String> stringList) {
        super(fm, behavior);
        this.fragments = fragments;
        this.stringList = stringList;
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return fragments.size();
    }


    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return stringList.get(position);
    }

    @Override
    public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
    }
}
